Lab9 examples
In [1]:
Copied!
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
# Example 1: Basic map with Search Control
m = ipyleaflet_Map(center=[37.7749, -122.4194], zoom=4)
m.add_search_control()
m.show_map()
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
# Example 1: Basic map with Search Control
m = ipyleaflet_Map(center=[37.7749, -122.4194], zoom=4)
m.add_search_control()
m.show_map()
Out[1]:
In [2]:
Copied!
# Example 2: Adding a custom WMS layer to the map
m = ipyleaflet_Map(center=[0, 0], zoom=2)
m.add_esa_worldcover()
m.show_map()
# Example 2: Adding a custom WMS layer to the map
m = ipyleaflet_Map(center=[0, 0], zoom=2)
m.add_esa_worldcover()
m.show_map()
Out[2]:
In [3]:
Copied!
#Example 3: Marker Clusters
import geopandas as gpd
# Load building centroids GeoJSON
url = "https://github.com/opengeos/datasets/releases/download/places/wa_building_centroids.geojson"
gdf = gpd.read_file(url)
# Add lat/lon columns from geometry
gdf["longitude"] = gdf.geometry.x
gdf["latitude"] = gdf.geometry.y
# Create map and add circle markers
m = ipyleaflet_Map(center=[gdf.latitude.mean(), gdf.longitude.mean()], zoom=14)
m.add_circle_markers_from_xy(gdf)
m.show_map()
#Example 3: Marker Clusters
import geopandas as gpd
# Load building centroids GeoJSON
url = "https://github.com/opengeos/datasets/releases/download/places/wa_building_centroids.geojson"
gdf = gpd.read_file(url)
# Add lat/lon columns from geometry
gdf["longitude"] = gdf.geometry.x
gdf["latitude"] = gdf.geometry.y
# Create map and add circle markers
m = ipyleaflet_Map(center=[gdf.latitude.mean(), gdf.longitude.mean()], zoom=14)
m.add_circle_markers_from_xy(gdf)
m.show_map()
Out[3]:
In [4]:
Copied!
#Example 4 : Add polygons, road lines, and choropleth
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
m = ipyleaflet_Map(center=[47.6588, -117.4260], zoom=12)
# Add building polygons
m.add_building_polygons("https://github.com/opengeos/datasets/releases/download/places/wa_overture_buildings.geojson")
m.add_layer_control()
m.show_map()
#Example 4 : Add polygons, road lines, and choropleth
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
m = ipyleaflet_Map(center=[47.6588, -117.4260], zoom=12)
# Add building polygons
m.add_building_polygons("https://github.com/opengeos/datasets/releases/download/places/wa_overture_buildings.geojson")
m.add_layer_control()
m.show_map()
Out[4]:
In [5]:
Copied!
# Add road lines
m = ipyleaflet_Map(center=[36.1699, -115.1398], zoom=12)
m.add_roads("https://github.com/opengeos/datasets/releases/download/places/las_vegas_roads.geojson")
m.add_layer_control()
m.show_map()
# Add road lines
m = ipyleaflet_Map(center=[36.1699, -115.1398], zoom=12)
m.add_roads("https://github.com/opengeos/datasets/releases/download/places/las_vegas_roads.geojson")
m.add_layer_control()
m.show_map()
Out[5]:
In [6]:
Copied!
# Add choropleth
m.add_choropleth("https://github.com/opengeos/datasets/releases/download/us/us_counties.geojson", "CENSUSAREA", colormap="YlOrRd_09")
m.add_layer_control()
m.show_map()
# Add choropleth
m.add_choropleth("https://github.com/opengeos/datasets/releases/download/us/us_counties.geojson", "CENSUSAREA", colormap="YlOrRd_09")
m.add_layer_control()
m.show_map()
Out[6]:
In [7]:
Copied!
# Example 5: Splitmap
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
pre_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif"
post_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif"
m = ipyleaflet_Map(center=[26.33, 17.23], zoom=12)
leafmap_split = m.add_split_rasters_leafmap(pre_url, post_url, overwrite=True)
leafmap_split
# Example 5: Splitmap
from GeoBay.GeoBay import CustomIpyleafletMap as ipyleaflet_Map
pre_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif"
post_url = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif"
m = ipyleaflet_Map(center=[26.33, 17.23], zoom=12)
leafmap_split = m.add_split_rasters_leafmap(pre_url, post_url, overwrite=True)
leafmap_split
Downloading... From: https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif To: C:\Users\shea9\Documents\Github\GeoBay\docs\examples\pre_event.tif
0%| | 0.00/72.1M [00:00<?, ?B/s]
1%|█▏ | 524k/72.1M [00:00<00:14, 4.99MB/s]
2%|███▋ | 1.57M/72.1M [00:00<00:08, 7.87MB/s]
4%|███████▎ | 3.15M/72.1M [00:00<00:07, 9.38MB/s]
7%|██████████▉ | 4.72M/72.1M [00:00<00:06, 10.6MB/s]
9%|██████████████▋ | 6.29M/72.1M [00:00<00:05, 11.3MB/s]
11%|██████████████████▎ | 7.86M/72.1M [00:00<00:05, 11.6MB/s]
13%|█████████████████████▉ | 9.44M/72.1M [00:00<00:05, 12.1MB/s]
15%|█████████████████████████▋ | 11.0M/72.1M [00:00<00:05, 12.2MB/s]
17%|█████████████████████████████▎ | 12.6M/72.1M [00:01<00:04, 12.1MB/s]
20%|████████████████████████████████▉ | 14.2M/72.1M [00:01<00:04, 12.3MB/s]
22%|████████████████████████████████████▋ | 15.7M/72.1M [00:01<00:04, 12.1MB/s]
24%|████████████████████████████████████████▎ | 17.3M/72.1M [00:01<00:04, 12.3MB/s]
26%|███████████████████████████████████████████▉ | 18.9M/72.1M [00:01<00:04, 12.5MB/s]
28%|███████████████████████████████████████████████▋ | 20.4M/72.1M [00:01<00:04, 12.3MB/s]
31%|███████████████████████████████████████████████████▎ | 22.0M/72.1M [00:01<00:04, 12.2MB/s]
33%|██████████████████████████████████████████████████████▉ | 23.6M/72.1M [00:02<00:03, 12.5MB/s]
35%|██████████████████████████████████████████████████████████▋ | 25.2M/72.1M [00:02<00:03, 12.5MB/s]
37%|██████████████████████████████████████████████████████████████▎ | 26.7M/72.1M [00:02<00:03, 12.4MB/s]
39%|█████████████████████████████████████████████████████████████████▉ | 28.3M/72.1M [00:02<00:03, 12.2MB/s]
41%|█████████████████████████████████████████████████████████████████████▋ | 29.9M/72.1M [00:02<00:03, 12.4MB/s]
44%|█████████████████████████████████████████████████████████████████████████▎ | 31.5M/72.1M [00:02<00:03, 12.5MB/s]
46%|████████████████████████████████████████████████████████████████████████████▉ | 33.0M/72.1M [00:02<00:03, 12.3MB/s]
48%|████████████████████████████████████████████████████████████████████████████████▌ | 34.6M/72.1M [00:02<00:03, 12.4MB/s]
50%|████████████████████████████████████████████████████████████████████████████████████▎ | 36.2M/72.1M [00:03<00:02, 12.2MB/s]
52%|███████████████████████████████████████████████████████████████████████████████████████▉ | 37.7M/72.1M [00:03<00:02, 12.3MB/s]
55%|███████████████████████████████████████████████████████████████████████████████████████████▌ | 39.3M/72.1M [00:03<00:02, 12.1MB/s]
57%|███████████████████████████████████████████████████████████████████████████████████████████████▎ | 40.9M/72.1M [00:03<00:04, 6.90MB/s]
63%|██████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 45.6M/72.1M [00:03<00:02, 13.1MB/s]
66%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 47.7M/72.1M [00:04<00:01, 12.9MB/s]
69%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 49.8M/72.1M [00:04<00:01, 12.9MB/s]
72%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 51.9M/72.1M [00:04<00:01, 12.8MB/s]
74%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 53.5M/72.1M [00:04<00:01, 12.6MB/s]
76%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 55.1M/72.1M [00:04<00:01, 12.7MB/s]
79%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 56.6M/72.1M [00:04<00:01, 12.5MB/s]
81%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 58.2M/72.1M [00:04<00:01, 12.7MB/s]
83%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 59.8M/72.1M [00:04<00:00, 12.5MB/s]
85%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 61.3M/72.1M [00:05<00:00, 12.5MB/s]
87%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 62.9M/72.1M [00:05<00:00, 12.5MB/s]
89%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 64.5M/72.1M [00:05<00:00, 12.6MB/s]
92%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 66.1M/72.1M [00:05<00:00, 12.5MB/s]
94%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 67.6M/72.1M [00:05<00:00, 12.7MB/s]
96%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 69.2M/72.1M [00:05<00:00, 12.6MB/s]
98%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 70.8M/72.1M [00:05<00:00, 12.3MB/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 72.1M/72.1M [00:05<00:00, 12.1MB/s]
Downloading... From: https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif To: C:\Users\shea9\Documents\Github\GeoBay\docs\examples\post_event.tif
0%| | 0.00/104M [00:00<?, ?B/s]
1%|▊ | 524k/104M [00:00<00:21, 4.72MB/s]
2%|██▌ | 1.57M/104M [00:00<00:13, 7.31MB/s]
3%|█████ | 3.15M/104M [00:00<00:10, 9.38MB/s]
5%|███████▋ | 4.72M/104M [00:00<00:09, 10.5MB/s]
6%|██████████▏ | 6.29M/104M [00:00<00:08, 11.2MB/s]
8%|████████████▊ | 7.86M/104M [00:00<00:08, 11.5MB/s]
9%|███████████████▎ | 9.44M/104M [00:00<00:08, 11.8MB/s]
11%|█████████████████▉ | 11.0M/104M [00:01<00:09, 9.52MB/s]
13%|██████████████████████▏ | 13.6M/104M [00:01<00:06, 13.1MB/s]
15%|████████████████████████▋ | 15.2M/104M [00:01<00:06, 13.0MB/s]
16%|███████████████████████████▎ | 16.8M/104M [00:01<00:06, 12.8MB/s]
18%|█████████████████████████████▊ | 18.4M/104M [00:01<00:06, 12.8MB/s]
19%|████████████████████████████████▍ | 19.9M/104M [00:01<00:06, 12.7MB/s]
21%|██████████████████████████████████▉ | 21.5M/104M [00:01<00:06, 12.4MB/s]
22%|█████████████████████████████████████▌ | 23.1M/104M [00:01<00:06, 12.5MB/s]
24%|████████████████████████████████████████ | 24.6M/104M [00:02<00:06, 12.5MB/s]
25%|██████████████████████████████████████████▋ | 26.2M/104M [00:02<00:06, 12.5MB/s]
27%|█████████████████████████████████████████████▏ | 27.8M/104M [00:02<00:07, 10.3MB/s]
29%|█████████████████████████████████████████████████▍ | 30.4M/104M [00:02<00:05, 13.3MB/s]
31%|████████████████████████████████████████████████████ | 32.0M/104M [00:02<00:05, 13.0MB/s]
32%|██████████████████████████████████████████████████████▌ | 33.6M/104M [00:02<00:05, 13.0MB/s]
34%|█████████████████████████████████████████████████████████▏ | 35.1M/104M [00:02<00:05, 12.8MB/s]
35%|███████████████████████████████████████████████████████████▋ | 36.7M/104M [00:03<00:05, 12.6MB/s]
37%|██████████████████████████████████████████████████████████████▎ | 38.3M/104M [00:03<00:05, 12.7MB/s]
38%|████████████████████████████████████████████████████████████████▊ | 39.8M/104M [00:03<00:05, 12.5MB/s]
40%|███████████████████████████████████████████████████████████████████▍ | 41.4M/104M [00:03<00:04, 12.5MB/s]
41%|█████████████████████████████████████████████████████████████████████▉ | 43.0M/104M [00:03<00:04, 12.8MB/s]
43%|████████████████████████████████████████████████████████████████████████▍ | 44.6M/104M [00:03<00:04, 12.7MB/s]
44%|███████████████████████████████████████████████████████████████████████████ | 46.1M/104M [00:03<00:04, 12.6MB/s]
46%|█████████████████████████████████████████████████████████████████████████████▌ | 47.7M/104M [00:03<00:04, 12.5MB/s]
47%|████████████████████████████████████████████████████████████████████████████████▏ | 49.3M/104M [00:04<00:04, 12.5MB/s]
49%|██████████████████████████████████████████████████████████████████████████████████▋ | 50.9M/104M [00:04<00:04, 12.4MB/s]
50%|█████████████████████████████████████████████████████████████████████████████████████▎ | 52.4M/104M [00:04<00:04, 12.7MB/s]
52%|███████████████████████████████████████████████████████████████████████████████████████▊ | 54.0M/104M [00:04<00:03, 12.5MB/s]
53%|██████████████████████████████████████████████████████████████████████████████████████████▍ | 55.6M/104M [00:04<00:03, 12.5MB/s]
55%|████████████████████████████████████████████████████████████████████████████████████████████▉ | 57.1M/104M [00:04<00:03, 12.7MB/s]
57%|███████████████████████████████████████████████████████████████████████████████████████████████▌ | 58.7M/104M [00:04<00:03, 12.5MB/s]
58%|██████████████████████████████████████████████████████████████████████████████████████████████████ | 60.3M/104M [00:04<00:03, 12.6MB/s]
60%|████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 61.9M/104M [00:05<00:03, 12.5MB/s]
61%|███████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 63.4M/104M [00:05<00:03, 12.4MB/s]
63%|█████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 65.0M/104M [00:05<00:03, 12.4MB/s]
64%|████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 66.6M/104M [00:05<00:03, 12.4MB/s]
66%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 68.2M/104M [00:05<00:02, 12.6MB/s]
67%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 69.7M/104M [00:05<00:02, 12.7MB/s]
69%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 71.3M/104M [00:05<00:02, 12.6MB/s]
70%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 72.9M/104M [00:05<00:02, 12.7MB/s]
72%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 74.4M/104M [00:06<00:02, 12.5MB/s]
73%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 76.0M/104M [00:06<00:02, 12.4MB/s]
75%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 77.6M/104M [00:06<00:02, 12.5MB/s]
76%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 79.2M/104M [00:06<00:01, 12.5MB/s]
78%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 80.7M/104M [00:06<00:01, 12.4MB/s]
79%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 82.3M/104M [00:06<00:01, 12.5MB/s]
81%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 83.9M/104M [00:06<00:01, 12.4MB/s]
82%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 85.5M/104M [00:06<00:01, 12.6MB/s]
84%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 87.0M/104M [00:07<00:01, 12.5MB/s]
85%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 88.6M/104M [00:07<00:01, 12.6MB/s]
87%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 90.2M/104M [00:07<00:01, 12.7MB/s]
88%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 91.8M/104M [00:07<00:00, 12.7MB/s]
90%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 93.3M/104M [00:07<00:00, 12.4MB/s]
91%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 94.9M/104M [00:07<00:00, 12.5MB/s]
93%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 96.5M/104M [00:07<00:00, 11.9MB/s]
94%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 98.0M/104M [00:07<00:00, 12.8MB/s]
96%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 99.6M/104M [00:08<00:00, 12.7MB/s]
97%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 101M/104M [00:08<00:00, 12.4MB/s]
99%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 103M/104M [00:08<00:00, 12.5MB/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 104M/104M [00:08<00:00, 12.3MB/s]
Out[7]:
In [ ]:
Copied!